﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace LIMS.Web
{
    public partial class StuProject : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                rpMyProject.DataSource = BLL.ProjectManager.SearchProject(null);
                rpMyProject.DataBind();

                //获取总记录数
                AspNetPager1.RecordCount = BLL.ProjectManager.SearchProject(null).Count;

            }
        }

     
        /// <summary>
        /// 根据教师ID获取其姓名
        /// </summary>
        /// <param name="teaID"></param>
        /// <returns></returns>
        protected String bindTeaNameByID(String teaID)
        {
            return BLL.TeacherManager.GetNameByID(teaID);
        }

    

        /// <summary>
        /// 字符串截取
        /// </summary>
        /// <param name="strInput">需要截断的字符串</param>
        /// <param name="nLength">截断字符串的长度</param>
        /// <returns></returns>
        protected string SubString(string strInput, int nLength)
        {
            if (strInput.Length <= nLength)
            {
                return strInput;
            }
            return strInput.Substring(0, nLength) + "…";
        }

        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            rpMyProject.DataSource = BLL.ProjectManager.SearchProject(null).
                Skip(AspNetPager1.PageSize * AspNetPager1.StartRecordIndex).Take(AspNetPager1.PageSize);
            rpMyProject.DataBind();
        }

        protected void rpMyProject_OnItemDataBound(object sender, RepeaterItemEventArgs e)
        {

            //字符串截取
            //string strInput = e.Cells[7].Text;
            //e.Row.Cells[7].Text = SubString(strInput, 18);
            //e.Row.Cells[7].ToolTip = strInput;
        }

    }
}